package com.ocom.aiot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.aiot.dao.IDaoSaasInfo;
import com.ocom.aiot.service.SaasInfoService;
import com.ocom.common.entity.aiot.EntitySaasInfo;
import com.ocom.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SaasInfoServiceImpl extends ServiceImpl<IDaoSaasInfo, EntitySaasInfo> implements SaasInfoService {

    @Autowired
    private IDaoSaasInfo daoSaasInfo;

    // 2.2.1.获取消费设备Saas平台列表(getSaasNameList)
    @Override
    public List<EntitySaasInfo> GetSaasNameList(String saasNo, String saasName) {
        QueryWrapper<EntitySaasInfo> query = Wrappers.query();
        if (StringUtils.isNotEmpty(saasNo)){
            query.eq("saas_no",saasNo);
        }
        if (StringUtils.isNotEmpty(saasName)){
            query.like("saas_name",saasName);
        }
        query.orderByAsc("saas_order");
        return daoSaasInfo.selectList(query);
    }
}
